package org.nmgyjt.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.nmgyjt.springboot.entity.materials.Materials;
import org.nmgyjt.springboot.entity.storeInfo.StoreInfo;

import java.util.List;
import java.util.Map;

@Mapper
public interface MaterialsMapper extends BaseMapper<Materials> {
    @Update("<script>\n" +
            "  update materials set state='1'  \n" +
            "    where id in \n" +
            "    <foreach item='id' index='index' collection='ids' open='(' separator=',' close=')'>\n" +
            "      #{id}\n" +
            "    </foreach>\n" +
            "</script>")
    int deleteByIds(@Param("ids") String[] ids);

    @Update("UPDATE materials a SET a.state = '1' WHERE a.store_id = #{id,jdbcType=INTEGER}")
    Integer deleteBystoreId(@Param("id") String id);
}
